chore(petab): retire the BnglModel adapter and register_bngl() now that petab 0.9.0 ships the loader, and drop Python 3.11 (#591) - #682
Merged
Conversation
…at petab 0.9.0 ships the loader, and drop Python 3.11 (#591) petab 0.9.0 (2026-09-07) is the first PyPI release whose known_model_types includes bngl: the native BnglModel loader PyBNF contributed upstream in PEtab-dev/libpetab-python#508 shipped. That is the trigger #591 was gated on. On any 0.9.0 installation register_bngl() already saw bngl registered and returned without rebinding, so the local adapter was dead at runtime and only the tests that constructed it directly still exercised it. Removed: pybnf/petab/bngl_model.py (the BnglModel adapter, register_bngl(), and its _locate_bng2 helper); the pytest-native-bngl CI leg that installed upstream libpetab-python main to reach the native loader ahead of a release; the setup-pybnf action's petab-spec input that leg used; the automodule entry for the removed module; and every register_bngl() call in the tests, the tutorial lessons (12, 13), the lint-clinic fixture generator, and the three real-world make_petab.py scripts. The petab and tests extras now floor at petab >= 0.9, and the action installs the same pin, which test_packaging_metadata already cross-checks. petab 0.9.0 requires Python >= 3.12, so the project floor moves to 3.12: requires-python, the classifier, ruff's target-version, the CI matrix, the packaging test, and the install/cluster docs and batch scripts that named 3.11. Kept: pybnf/petab/_bngl.py, the reader the importer and exporter use (its drift note now points at the shipped upstream module), and pybnf/petab/_bngl_expr.py, the parameter-expression evaluator from #666. The adapter was the evaluator's only consumer, and petab's native BnglModel does not evaluate an expression-valued parameter (get_parameter_value raises NotImplementedError, get_free_parameter_ids_with_values skips it). That is not a regression of this change, since the no-op already routed 0.9.0 users to the native class, but it is the next upstream port; the evaluator stays as its staging copy and its unit tests now drive the evaluator directly. Tests: the adapter's unit tests are replaced by TestNativeBnglModel, which pins the ABC seam the exporter relies on (parameter ids and values, entity namespace, formula symbols, state variables) against petab's class and asserts the native loader is present, taking over the retired CI leg's assert step. The corpus validity test passes an explicit model_id because petab derives one from the file stem and requires a PEtab identifier, which the hyphenated corpus filenames are not. tests/_bngl_differential.py carries its own _locate_bng2. The tutorial tests import BnglModel and _locate_bng2 from petab where they still need them. Locally, under petab 0.9.0 on Python 3.12: every test_petab*.py, the PEtab tutorial tests, the lint clinic, the priors lesson, new-era validation, and the packaging metadata tests pass (730 passed). The pinned ruff gate and the -W docs build are clean. ADR-0026 gains an addendum; CHANGELOG records the floor change and the removal.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #591.
The gate cleared on 2026-09-07: petab 0.9.0 is the first PyPI release whose
known_model_typesincludesbngl, carrying the nativeBnglModelloader PyBNF contributed upstream in PEtab-dev/libpetab-python#508. On any 0.9.0 installationregister_bngl()already sawbnglregistered and returned without rebinding, so the local adapter was dead at runtime and only the tests that constructed it directly still exercised it.Removed
pybnf/petab/bngl_model.py: theBnglModeladapter,register_bngl(), and its_locate_bng2helper, plus the automodule entry.pytest-native-bnglCI leg that installed upstream libpetab-pythonmainto reach the native loader ahead of a release, and the setup action'spetab-specinput it used.register_bngl()call in the tests, tutorial lessons 12 and 13, the lint-clinic fixture generator, and the three real-worldmake_petab.pyscripts. The docs section on the loader now shows the plain petab call.Python 3.11 dropped
The
petabandtestsextras now floor atpetab >= 0.9(the action installs the same pin;test_packaging_metadatacross-checks the two). petab 0.9.0 requires Python 3.12, so the project floor moves with it:requires-python, the classifier, ruff'starget-version, the CI matrix, the packaging test, and the install/cluster docs and batch scripts that named 3.11.Kept, and one gap this exposes
_bngl.pystays: it is the reader the importer and exporter use, and its drift note now points at the shipped upstream module rather than a branch._bngl_expr.py(the #666 parameter-expression evaluator) also stays, with a caveat worth knowing. The adapter was its only consumer, and petab's nativeBnglModeldoes not evaluate an expression-valued parameter:get_parameter_valueraisesNotImplementedErrorandget_free_parameter_ids_with_valuesskips it. That is the pre-#666 behaviour on the petab-side validation path. It is not a regression of this PR, since the no-op already routed 0.9.0 users to the native class, but the #666 fix never reached the path it was written for. #681 tracks the upstream port; the evaluator stays as its staging copy and its unit tests now drive it directly.Tests
TestNativeBnglModelreplaces the adapter unit tests: it pins the ABC seam the exporter relies on (parameter ids and values, entity namespace, formula symbols, state variables) against petab's class, and asserts the native loader is present, taking over the retired CI leg's assert step.model_id: petab derives one from the file stem and requires a PEtab identifier, which the hyphenated corpus filenames are not.tests/_bngl_differential.pycarries its own_locate_bng2; the tutorial tests importBnglModel/_locate_bng2from petab where they still need them.Locally under petab 0.9.0 on Python 3.12, every
test_petab*.pyfile, the PEtab tutorial tests, the lint clinic, the priors lesson, new-era validation, and the packaging metadata tests pass (730 passed). The pinned ruff gate and the-Wdocs build are clean. ADR-0026 gains an addendum and the CHANGELOG records the floor change and the removal.